/*
 * Web Crawler
 * Date: November 01, 2011
 * Group JEDi
 * Author(s): James Lovato, Efim Todorasco, Daniel Garrison
 */
package multithread;
/**
 * A class that stores all of the information collected from a Parser thread.
 * These objects are meant to be created in a Parser thread and then passed to
 * a ThreadSafeGatherer object.
 * 
 * @author James Lovato, Efim Todorasco, Daniel Garrison
 * @version Fall 2011
 *
 */
public class DataMetrics {
	/**
	 * The url string.
	 */
	private String my_url;
	
	/**
	 * The page number.
	 */
	private int my_page_number;
	
	/**
	 * The total number of words on this page.
	 */
	private int my_num_words;
	
	/**
	 * The number of links
	 */
	private int my_num_links;
	
	/**
	 * An array of counts of search word hits.
	 */
	private int[] my_hits;
	
	/**
	 * Time parser spent retrieving a document, parsing it, and creating this metrics.
	 */
	private long my_parse_time;
	
	/**
	 * Constructor for single page DataMetrics.
	 * @param the_page_number the number of this page.
	 * @param the_num_words the total number of words on one page.
	 * @param the_num_links the total number of links on one page.
	 * @param the_hits an array counting the number of times each word is counted.
	 * @param the_url the url of this page.
	 * @param the_parse_time the time spent parsing this page.
	 */
	public DataMetrics(int the_page_number, int the_num_words, int the_num_links, int[] the_hits, 
			String the_url, long the_parse_time) {
		my_page_number = the_page_number;
		my_num_words = the_num_words;
		my_num_links = the_num_links;
		my_hits = the_hits;
		my_url = the_url;
		my_parse_time = the_parse_time;
	}
	
	/**
	 * How many words were on the parsed page?
	 * @return number of words counted on the parsed page.
	 */
	public int wordCount() {
		return my_num_words;
	}
	
	/**
	 * How many links were on the parsed page?
	 * @return number of links counted on the parsed page.
	 */
	public int linkCount() {
		return my_num_links;
	}
	
	/**
	 * How many times was each search word found within the parsed page?
	 * @return an array containing the number of times each search word was found.
	 */
	public int[] hitCount() {
		return my_hits;
	}
	
	/**
	 * What is your page number?
	 * @return the number of this page.
	 */
	public int  pageNumber() {
		return my_page_number;
	}
	
	/**
	 * What is your url? (actually uri)
	 * @return String with URL 
	 */
	public String getURL() {
		return my_url;
	}
	
	/**
	 * What was your parse time.
	 */
	public long parseTime() {
		return my_parse_time;
	}
}
